//
//  HWpinglunFrame.m
//  HWanGame
//
//  Created by 陈道斌 on 2021/8/31.
//  Copyright © 2021 Chendaobin. All rights reserved.
//

#import "HWpinglunFrame.h"

@implementation HWpinglunFrame


-(void)setDatamodel:(HWpinglunModel *)datamodel {
    
    _datamodel = datamodel;
    
    
    //  datamodel.content
    
    CGSize   size2 =    [WMUtil sizeWithFont1:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(kScreenW-60-15, 2000) string:datamodel.content];
    NSInteger gaudo = 0;
    if (datamodel.images.count > 0 ) {

        gaudo = (datamodel.images.count - 1)/3+1;

    }
    
    self.icoViewgaoduo = gaudo*85+(gaudo-1)*10+10;
    
    
    self.sectionHeight =  38+15+5 + size2.height + 10 + gaudo*85 + (gaudo-1)*10;
    
    
    NSString *content = @"";
    
    if (datamodel.beihuifu_user_name == nil  ) {
        content = [NSString stringWithFormat:@"%@:%@",datamodel.user_name, datamodel.content];
    } else {
    
        if ([datamodel.user_name isEqualToString:datamodel.beihuifu_user_name]) {
        
            content = [NSString stringWithFormat:@"%@:%@",datamodel.user_name, datamodel.content];
             
        } else {

            content = [NSString stringWithFormat:@"%@回复%@:%@",datamodel.user_name,datamodel.beihuifu_user_name ,datamodel.content];
        }
        //   content = [NSString stringWithFormat:@"%@回复%@:%@",model.user_name,model.beihuifu_user_name ,model.content];
        
    }
    
    CGSize   size3 =    [WMUtil sizeWithFont1:[UIFont systemFontOfSize:14] maxSize:CGSizeMake(kScreenW-60-15-20, 2000) string:content];
    CGFloat a=  5;
  //   self.neirongtextview.text = content;
    if (size2.height < 17) {
       //  a= 10;
        self.contentHeight =   size3.height+a;
        
    } else {
        // a=  -10;
        self.contentHeight =   size3.height+a;
        
    }
    
    
    
    
    
}
@end
